package com.fujitsu.nanjing.tieba.dao;

import com.fujitsu.nanjing.tieba.ibator.CoreTrashBox;
import com.fujitsu.nanjing.tieba.ibator.CoreTrashBoxCriteria;
import com.fujitsu.nanjing.tieba.ibator.CoreTrashBoxKey;
import java.util.List;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class CoreTrashBoxDAOImpl extends SqlMapClientDaoSupport implements CoreTrashBoxDAO {

    public CoreTrashBoxDAOImpl() {
        super();
    }

    public int countByExample(CoreTrashBoxCriteria example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("core_trash_box.countByExample", example);
        return count;
    }

    public int deleteByExample(CoreTrashBoxCriteria example) {
        int rows = getSqlMapClientTemplate().delete("core_trash_box.deleteByExample", example);
        return rows;
    }

    public int deleteByPrimaryKey(CoreTrashBoxKey _key) {
        int rows = getSqlMapClientTemplate().delete("core_trash_box.deleteByPrimaryKey", _key);
        return rows;
    }

    public void insert(CoreTrashBox record) {
        getSqlMapClientTemplate().insert("core_trash_box.insert", record);
    }

    public void insertSelective(CoreTrashBox record) {
        getSqlMapClientTemplate().insert("core_trash_box.insertSelective", record);
    }

    @SuppressWarnings("unchecked")
    public List<CoreTrashBox> selectByExample(CoreTrashBoxCriteria example) {
        List<CoreTrashBox> list = getSqlMapClientTemplate().queryForList("core_trash_box.selectByExample", example);
        return list;
    }

    public CoreTrashBox selectByPrimaryKey(CoreTrashBoxKey _key) {
        CoreTrashBox record = (CoreTrashBox) getSqlMapClientTemplate().queryForObject("core_trash_box.selectByPrimaryKey", _key);
        return record;
    }

    public int updateByExampleSelective(CoreTrashBox record, CoreTrashBoxCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_trash_box.updateByExampleSelective", parms);
        return rows;
    }

    public int updateByExample(CoreTrashBox record, CoreTrashBoxCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_trash_box.updateByExample", parms);
        return rows;
    }

    public int updateByPrimaryKeySelective(CoreTrashBox record) {
        int rows = getSqlMapClientTemplate().update("core_trash_box.updateByPrimaryKeySelective", record);
        return rows;
    }

    public int updateByPrimaryKey(CoreTrashBox record) {
        int rows = getSqlMapClientTemplate().update("core_trash_box.updateByPrimaryKey", record);
        return rows;
    }

    protected static class UpdateByExampleParms extends CoreTrashBoxCriteria {
        private Object record;

        public UpdateByExampleParms(Object record, CoreTrashBoxCriteria example) {
            super(example);
            this.record = record;
        }

        public Object getRecord() {
            return record;
        }
    }
}